package com.wushi.service;


import com.wushi.dao.WxNewsMapper;
import com.wushi.model.WxNews;
import com.wushi.smartorm.OrmMapperProxyFactory;
import org.springframework.stereotype.Service;

/**
 * @program: mybatisstudy
 * @description:
 * @author: Grant Wu
 * @create: 2020-05-10 00:11
 **/

@Service
public class WxNewsService {
    //这里不能直接注入，如果直接注入的话就是用的Spring容器了。
    //所以还是用mybatis直接使用的方式，方便理解入口
//    @Autowired
//    private WxNewsMapper wxNewsMapper;

    public WxNews queryNews(Long id){
        OrmMapperProxyFactory<WxNewsMapper> ormMapperFactory=new OrmMapperProxyFactory();
        //Step1获取代理类
        WxNewsMapper newsMapper= ormMapperFactory.getMapper(WxNewsMapper.class);
        WxNews wxNews = newsMapper.selectByPrimaryKey(id);
        return wxNews;
    }
}
